<template>
    <div class="container">
        <div class="handle-box">
                <el-form ref="form" :model="form" label-width="120px" class="flex">
                    <el-form-item label="账户名称：">
                        <el-input v-model="names" placeholder="请输入名称" class="handle-input mr10" @input="mohu()"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" icon="el-icon-search">查询</el-button>
                        <el-button type="success" icon="el-icon-plus" @click="add">新增</el-button>
                    </el-form-item>
                </el-form>
            </div>
            <el-table
                :data="tableData.slice((currentPage-1)*pagesize,currentPage*pagesize)"
            >
                <el-table-column type="index" :index="indexMethod" label="ID"></el-table-column>
                <el-table-column prop="NAME" label="账户名称"  align="center"></el-table-column>
                <el-table-column prop="ROLE_NAME" label="角色名称"></el-table-column>
                <el-table-column prop="" label="所属区域"></el-table-column>
                <!-- <el-table-column prop="STREET_NAME" label="所属街道"></el-table-column>
                <el-table-column prop="ORGANIZATION" label="所属机构"></el-table-column> -->
                <el-table-column prop="ADDRESS" label="地址"></el-table-column>
                <el-table-column prop="USERNAME" label="用户名"></el-table-column>
                <el-table-column prop="PASSWORD" label="用户密码"></el-table-column>
                <el-table-column prop="TELEPHONE" label="电话"></el-table-column>
                <el-table-column prop="SEX" label="性别"></el-table-column>
                <el-table-column label="操作" width="180" align="center">
                    <template slot-scope="scope">
                        <el-button
                            type="text"
                            @click="handleEdit(scope.$index, scope.row)"
                        >编辑</el-button>
                        <el-button
                            type="text"
                            @click="handleDelete(scope.$index, scope.row)" style="color:red"
                        >删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination">
                <el-pagination
                    background
                    layout="total, sizes, prev, pager, next, jumper"
                    :current-page="currentPage"  
                    :page-size="pageSize"
                    :total="tableData.length"
                    @size-change="handleSizeChange"
                    @current-change="handlePageChange"
                ></el-pagination>
            </div>
            <el-dialog v-dialogDrag title="编辑角色" :visible.sync="editVisible" width="50%">
                <el-form ref="editform" :model="editform" label-width="100px" class="flex">
                    <el-form-item label="名称："   class="wid50">
                        <el-input v-model="editform.NAME" placeholder="请输入名称" class="handle-input mr10"></el-input>
                    </el-form-item>
                    <el-form-item label="角色级别："   class="wid50">
                        <el-select v-model="editform.USERLEVEL" placeholder="请选择" @change="changerole">
                          <el-option v-for="item in rolelevel" :key='item.rolelevelindex' :label="item.roleleveltitle" :value="item.roleleveltitle">
                          </el-option>
                        </el-select>
                    </el-form-item> 
                    <el-form-item label="角色名称："   class="wid50">
                        <el-select v-model="editform.ROLE_NAME" placeholder="请选择" >
                          <el-option v-for="item in tableDataList" :key='item.ROLEID' :label="item.ROLE_NAME" :value="item.ROLEID">
                          </el-option>
                        </el-select>
                    </el-form-item>          
                     <el-form-item label="所属地区：" class="wid50 " v-show="displaynone">
                       <el-select v-model="editform.REGION" value-key="id" placeholder="请选择" @change="changevalue" >
                          <el-option v-for="item in option" :key='item.CLIENT_NO' :label="item.NAME" date-name = "item.NAME"  :value="item.CLIENT_NO" >
                          </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="所属街道：" class="wid50 " v-show="displaytnone">
                       <el-select v-model="editform.STREET" placeholder="请选择" @change="changecommunitvalue">
                          <el-option v-for="item in optionsstreet" :key='item.CLIENT_NO' date-name = "item.NAME" :label="item.NAME" :value="item.CLIENT_NO">
                          </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="所属社区：" class="wid50 " v-show="displayenone">
                       <el-select v-model="editform.COMMUNITY" placeholder="请选择" @change="changeplot">
                          <el-option v-for="item in optionscommunit" :key='item.CLIENT_NO' date-name = "item.NAME" :label="item.NAME" :value="item.CLIENT_NO">
                          </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="所属小区：" class="wid50 " v-show="displayfnone">
                       <el-select v-model="editform.VILLAGE" placeholder="请选择" @change="plotchange">
                          <el-option v-for="item in optionsplot" :key='item.CLIENT_NO'  date-name = "item.NAME" :label="item.NAME" :value="item.CLIENT_NO">
                          </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="性别："  class="wid50">
                        <el-select v-model="editform.SEX" placeholder="请选择" >
                          <el-option v-for="item in sex" :key='item.sexindex' :label="item.sexcom" :value="item.sexindex">
                          </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="邮箱："  class="wid50">
                        <el-input v-model="editform.EMAIL" placeholder="请输入邮箱" class="handle-input mr10"></el-input>
                    </el-form-item>
                    <el-form-item label="地址："  class="wid50">
                        <el-input v-model="editform.ADDRESS" placeholder="请输入地址" class="handle-input mr10"></el-input>
                    </el-form-item>
                     <el-form-item label="绑定账号："  class="wid50">
                        <el-input v-model="editform.USERNAME" placeholder="请输入账号" class="handle-input mr10"></el-input>
                    </el-form-item>
                    <el-form-item label="绑定密码："  class="wid50">
                        <el-input v-model="editform.PASSWORD" placeholder="请输入密码" class="handle-input mr10" show-password></el-input>
                    </el-form-item>
                    <el-form-item label="电话："  class="wid50">
                        <el-input v-model="editform.TELEPHONE" placeholder="请输入电话" class="handle-input mr10"></el-input>
                    </el-form-item>
                </el-form>
                <span slot="footer" class="dialog-footer">
                    <el-button @click="editVisible = false">取 消</el-button>
                    <el-button type="primary" @click="saveEdit()">确 定</el-button>
                </span>
            </el-dialog>
            <!-- 新增弹框 -->
            <el-dialog v-dialogDrag title="新增账号" :visible.sync="addVisible" width="50%">
                <el-form ref="addform" :model="addform" label-width="120px" class="flex">
                    <el-form-item label="名称："   class="wid50">
                        <el-input v-model="addform.name" placeholder="请输入名称" class="handle-input mr10"></el-input>
                    </el-form-item>
                    <el-form-item label="角色级别："   class="wid50">
                        <el-select v-model="addform.roleleveltitle" placeholder="请选择" @change="changerole">
                          <el-option v-for="item in rolelevel" :key='item.rolelevelindex' :label="item.roleleveltitle" :value="item.roleleveltitle">
                          </el-option>
                        </el-select>
                    </el-form-item> 
                    <el-form-item label="角色名称："   class="wid50">
                        <el-select v-model="addform.ROLE_NAME" placeholder="请选择" >
                          <el-option v-for="item in tableDataList" :key='item.ROLEID' :label="item.ROLE_NAME" :value="item.ROLEID">
                          </el-option>
                        </el-select>
                    </el-form-item>          
                     <el-form-item label="所属地区：" class="wid50 " v-show="displaynone">
                       <el-select v-model="addform.CLIENT_NO" value-key="id" placeholder="请选择" @change="changevalue" >
                          <el-option v-for="item in option" :key='item.CLIENT_NO' :label="item.NAME" date-name = "item.NAME"  :value="item.CLIENT_NO" >
                          </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="所属街道：" class="wid50 " v-show="displaytnone">
                       <el-select v-model="addform.STREET_ID" placeholder="请选择" @change="changecommunitvalue">
                          <el-option v-for="item in optionsstreet" :key='item.CLIENT_NO' date-name = "item.NAME" :label="item.NAME" :value="item.CLIENT_NO">
                          </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="所属社区：" class="wid50 " v-show="displayenone">
                       <el-select v-model="addform.COMMUNITY_ID" placeholder="请选择" @change="changeplot">
                          <el-option v-for="item in optionscommunit" :key='item.CLIENT_NO' date-name = "item.NAME" :label="item.NAME" :value="item.CLIENT_NO">
                          </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="所属小区：" class="wid50 " v-show="displayfnone">
                       <el-select v-model="addform.VILLAGE_ID" placeholder="请选择" @change="plotchange">
                          <el-option v-for="item in optionsplot" :key='item.CLIENT_NO'  date-name = "item.NAME" :label="item.NAME" :value="item.CLIENT_NO">
                          </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="性别："  class="wid50">
                        <el-select v-model="addform.SEX" placeholder="请选择" >
                          <el-option v-for="item in sex" :key='item.sexindex' :label="item.sexcom" :value="item.sexindex">
                          </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="邮箱："  class="wid50">
                        <el-input v-model="addform.EMAIL" placeholder="请输入邮箱" class="handle-input mr10"></el-input>
                    </el-form-item>
                    <el-form-item label="地址："  class="wid50">
                        <el-input v-model="addform.ADDRESS" placeholder="请输入地址" class="handle-input mr10"></el-input>
                    </el-form-item>
                     <el-form-item label="绑定账号："  class="wid50">
                        <el-input v-model="addform.USERNAME" placeholder="请输入账号" class="handle-input mr10"></el-input>
                    </el-form-item>
                    <el-form-item label="绑定密码："  class="wid50">
                        <el-input v-model="addform.PASSWORD" placeholder="请输入密码" class="handle-input mr10"  show-password></el-input>
                    </el-form-item>
                    <el-form-item label="电话："  class="wid50">
                        <el-input v-model="addform.TELEPHONE" placeholder="请输入电话" class="handle-input mr10"></el-input>
                    </el-form-item>
                </el-form>
                <span slot="footer" class="dialog-footer">
                    <el-button @click="addVisible = false">取 消</el-button>
                    <el-button type="primary" @click="saveadd(addform)">确 定</el-button>
                </span>
            </el-dialog>
        </div>
</template>
<script>
const cityOptions = [
{title:'分类信息',index:1},
{title:'居民分类信息',index:2},
{title:'单位分类信息',index:3},
{title:'实时动态',index:4},
{title:'实时投放',index:5},
{title:'指导员',index:6},
{title:'大数据统计',index:7},
{title:'积分统计',index:8},
{title:'累计投放积分规则设置',index:9},
{title:'消费积分规则设置',index:10},
{title:'积分展示',index:11},
{title:'街道积分',index:12},
{title:'社区积分',index:13},
{title:'小区积分',index:14},
{title:'居民积分',index:15},
{title:'垃圾量统计',index:16},
{title:'垃圾收集量',index:17},
{title:'街道统计',index:18},
{title:'社区统计',index:19},
{title:'小区统计',index:20},
{title:'居民统计',index:21},
{title:'机关单位',index:22},
{title:'基本信息',index:23},
{title:'街道信息管理',index:24},
{title:'社区信息管理',index:25},
{title:'小区信息管理',index:26},
{title:'居民信息管理',index:27},
{title:'机关事业单位/餐饮单位',index:28},
{title:'指导员信息管理',index:29},
{title:'收集员信息管理',index:39},
// {title:'巡查员信息管理',index:30},
{title:'垃圾点管理',index:31},
// {title:'巡查记录统计',index:32},
{title:'角色管理',index:33},
{title:'图片上传',index:34},
{title:'垃圾收集量上传',index:40}];
import '../../assets/css/common.css'

export default {
    data(){
        return{
            currentPage:1, //初始页
            pagesize:10,    //    每页的数据
            userList: [],
            address:'',
            name:'',
            addVisible:false,
            checkAll: false,
            checkedCities: [],
            cities: cityOptions,
            isIndeterminate: true,
            tableData: [],
            multipleSelection: [],
            delList: [],
            editVisible: false,
            pageTotal: 0,
            editform: {},
            addform:{},
            idx: -1,
            id: -1,
            regionname:'',
            checklall: '',
            editobject: {},
            options: [],
            optionsstreet:[],
            optionscommunit:[],
            optionsplot: [],
            tableDataList: [],
            regionflag: false,
            displaynone: true,
            displaytnone: true,
            displayenone: true,
            displayfnone: true,
            organization: '',
            client_no: '',
            names:'',
            sex: [{
                sexcom: '男',
                sexindex: 1
            },{
                sexcom: '女',
                sexindex: 2
            }],
            rolelevel: [{
                roleleveltitle: '行政区',
                rolelevelindex: 1 
            },{
                roleleveltitle: '街道',
                rolelevelindex: 2 
            },{
                roleleveltitle: '社区',
                rolelevelindex: 3 
            },{
                roleleveltitle: '小区',
                rolelevelindex: 4 
            },{
                roleleveltitle: '机关单位',
                rolelevelindex: 5 
            }]
        }
    },
    created() {
        // this.getData();
        // this.getrole()
        this.getrolelist()
        this.getselect()
    },
    methods: {
        // getrole(){
        //     this.$axios({
        //         url: 'http://111.160.78.62:5575/GarbagePointsTYApi/Role/GetRoleModelsApi',
        //         method: 'get'
        //     }).then(res=>{
        //         this.tableData = Object.assign(res.data)
        //     })
        // },
        changerole (e){
            this.getxiallist(e)
            console.log(e)
            // this.displaytnone = false
            // console.log(localStorage.getItem('streetname'))
            if(e == '行政区'){
                // alert(1)
                this.organization = Object.assign([],localStorage.getItem('regionname'))
                this.client_no = Object.assign([],localStorage.getItem('regionid'))
                this.displaynone = true
                this.displaytnone = false
                this.displayenone = false
                this.displayfnone = false
            }else if(e == '街道'){
                this.organization = Object.assign([],localStorage.getItem('streetname'))
                this.client_no = Object.assign([],localStorage.getItem('streetid'))
                this.displaynone = true
                this.displaytnone = true
                this.displayenone = false
                this.displayfnone = false
            }else if(e == "社区"){
                this.organization = Object.assign([],localStorage.getItem('communitname'))
                this.client_no = Object.assign([],localStorage.getItem('communitid'))
                this.displaynone = true
                this.displaytnone = true
                this.displayenone = true
                this.displayfnone = false
            }else if(e == '小区'){
                this.organization = Object.assign([],localStorage.getItem('plotname'))
                this.client_no = Object.assign([],localStorage.getItem('plotid'))
                this.displaynone = true
                this.displaytnone = true
                this.displayenone = true
                this.displayfnone = true
            }else if(e == '机关单位'){
                this.organization = Object.assign([],localStorage.getItem('streetname'))
                this.client_no = Object.assign([],localStorage.getItem('streetid'))
                this.displaynone = true
                this.displaytnone = true
                this.displayenone = false
                this.displayfnone = false
            }
        },
        indexMethod(index) {
          return index + 1;
        },
         // 行政区下拉列表
        getselect () {
          this.$axios({
            url:this.$url + '/GetRegionListByClientApi',
            method: 'get'
          }).then(res => {
            //   console.log(res.data)
            this.option = Object.assign([], res.data)
          })
        },
        // 获取街道
        changevalue(e){
            localStorage.setItem('regionid',e)
            console.log(e)
            this.option.filter(res=>{
                if(res.CLIENT_NO == e){
                    console.log(res.NAME)
                    localStorage.setItem('regionname',res.NAME)
                }
            })
            let obj = {};
            obj = this.tableData.find((item)=>{//这里的selectList就是上面遍历的数据源
            // console.log(item)
                // return item.id === vId;//筛选出匹配数据
            });
            // console.log(obj.name);//我这边的name就是对应label的
            // console.log(obj.id);

            this.$axios({
                url:this.$url + '/sreetListsByClientApi',
                method: 'get',
                params: {
                    id : e
                }
            }).then(res=>{
                console.log(res.data)
                this.optionsstreet = Object.assign([],res.data)
            })
            // this.$axios({
            //     url: 'http://111.160.78.62:5575/GarbagePointsTYApi/BasicData/clientHotelApi',
            //     method: 'get',
            //     params: {
            //         id: e
            //     }
            // }).then(res=>{
            //     console.log(res.data)
            // })
        },
        // 获取社区
        changecommunitvalue(e){
            localStorage.setItem('streetid',e)
            this.optionsstreet.filter(res=>{
                if(res.CLIENT_NO == e){
                    console.log(res.NAME)
                    localStorage.setItem('streetname',res.NAME)
                }
            })
            console.log(e)
            this.$axios({
                url: this.$url + '/communityListsByClientApi',
                method: 'get',
                params: {
                    id: e
                }
            }).then(res=>{
                console.log(res.data)
                this.optionscommunit = Object.assign([],res.data)
            })
            // this.optionscommunit = data.filter(item => {
            //     console.log(item)
            //     return item 
            // })
        },
        // 获取小区
        changeplot(e){
            localStorage.setItem('communitid',e)
            this.optionscommunit.filter(res=>{
                if(res.CLIENT_NO == e){
                    console.log(res.NAME)
                    localStorage.setItem('communitname',res.NAME)
                }
            })
            console.log(e)
            this.$axios({
                url: this.$url + '/villageListsByClientApi',
                method: 'get',
                params: {
                    id: e
                }
            }).then(res=>{
                console.log(res.data)
                this.optionsplot = Object.assign([],res.data)
            })
        },
        plotchange(e){
            localStorage.setItem('plotid',e)
            this.optionsplot.filter(res=>{
                console.log(res)
                if(res.CLIENT_NO == e){
                    console.log(res.NAME)
                    localStorage.setItem('plotname',res.NAME)
                }
            })
        },
        // // 获取机关单位
        // gethodellist(){

        // },
        // 获取角色名称
        getxiallist(e){
            this.$axios({
                // http://111.160.78.62:5578
                url: this.$rurl + '/GetRolesByLevelApi?LevelName='+ e,
            }).then(res=>{
                console.log(res.data)
                this.tableDataList = Object.assign([],res.data)
            })
        },
        // 获取用户
        getrolelist(){
            this.$axios({
                url: this.$rurl + '/GetUserListApi',
                method: 'get'
            }).then(res=>{
                console.log(res.data)
                this.tableData = Object.assign([],res.data)
            })
        },
        handleCheckAllChange(value) {
            console.log(value)
            this.checkedCities = val ? cityOptions : [];
            this.isIndeterminate = false;
        },
        handleCheckedCitiesChange(value) {
            // console.log()
            this.checklall = Object.assign([],value)
            let checkedCount = value.length;
            this.checkAll = checkedCount === this.cities.length;
            this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
        },    
        //新增
        add(){
            this.addVisible = true;
           
        },
        // 新增保存
        saveadd(addform){
            let client_no='';
            if(addform.roleleveltitle=='小区')
                client_no=addform.VILLAGE_ID;
            if(addform.roleleveltitle=='社区')
                client_no=addform.COMMUNITY_ID;
            if(addform.roleleveltitle=='街道')
                client_no=addform.STREET_ID;
            if(addform.roleleveltitle=='行政区')
            client_no=addform.CLIENT_NO;
            debugger
            console.log((this.client_no).join(''))
            console.log({
                    NAME: addform.name,
                    // CLIENT_NO: addform.CLIENT_NO,
                    TELEPHONE: addform.TELEPHONE,
                    USERNAME: addform.USERNAME,
                    PASSWORD: addform.PASSWORD,
                    USERLEVEL: addform.roleleveltitle,
                    STREET_ID: addform.STREET_ID,
                    COMMUNITY_ID: addform.COMMUNITY_ID,
                    VILLAGE_ID: addform.VILLAGE_ID,
                    ADDRESS: addform.ADDRESS,
                    EMAIL: addform.EMAIL,
                    ROLEID: addform.ROLEID,
                    ORGANIZATION: (this.organization).join(''),
                    CLIENT_NO: (this.client_no).join('')
                })
            this.$axios({
                url:this.$url + '/AddUserApi',
                method: 'post',
                data:{
                    NAME: addform.name,
                    // CLIENT_NO: addform.CLIENT_NO,
                    TELEPHONE: addform.TELEPHONE,
                    USERNAME: addform.USERNAME,
                    PASSWORD: addform.PASSWORD,
                    USERLEVEL: addform.roleleveltitle,
                    STREET_ID: addform.STREET_ID,
                    COMMUNITY_ID: addform.COMMUNITY_ID,
                    VILLAGE_ID: addform.VILLAGE_ID,
                    ADDRESS: addform.ADDRESS,
                    EMAIL: addform.EMAIL,
                    ROLEID: addform.ROLE_NAME,
                    ORGANIZATION: (this.organization).join(''),
                    CLIENT_NO: client_no
                    // ORGANIZATION: localStorage.getItem('regionname') + '/' +localStorage.getItem('streetname') + '/' + localStorage.getItem('coummitname')
                }
            }).then(res=>{
                console.log(res)
                if(res.data.IsSucess){
                    this.$message.success('新增成功')
                    this.addform = Object.assign({},undefined)
                    this.addVisible = false
                    this.getrolelist()
                }
            })
            // console.log(checkindex.join(","))
        },
        // 模糊查询
        mohu() {
            var search = this.names;
            console.log(search)
            var newdate = [];
            if(search){
                 this.tableData.filter(item=>{
                     console.log(item)
                    if(item.NAME.includes(search)){
                        console.log(item)
                        newdate.push(item)
                    }
                })
            }else if (search == ''){
                // alert('空')
               this.getrolelist()
            }
            this.tableData = newdate
        },
        // 编辑操作
        handleEdit(index, row) {
            console.log(this.$url)
            console.log(row)
            this.editform.CLIENT_NO = row.REGION
            if(row.USERLEVEL == '街道'){
                this.displaynone = true
                this.displaytnone = true
                this.displayenone = false
                this.displayfnone = false
                this.addform.STREET_ID = row.CLIENT_NO
            }else if(row.USERLEVEL == '行政区'){
                this.displaynone = true
                this.displaytnone = false
                this.displayenone = false
                this.displayfnone = false
                this.addform.CLIENT_NO = row.CLIENT_NO
            }else if(row.USERLEVEL == '社区'){
                this.displaynone = true
                this.displaytnone = true
                this.displayenone = true
                this.displayfnone = false
                this.addform.COMMUNITY_ID = row.CLIENT_NO
            }else if(row.USERLEVEL == '小区'){
                this.displaynone = true
                this.displaytnone = true
                this.displayenone = true
                this.displayfnone = true
                this.addform.VILLAGE_ID = row.CLIENT_NO
            }
            // this.idx = index;
            // console.log(this.checklall)
            // this.checkedCities = this.checklall
            // this.form = row;
            this.form = row
            this.editVisible = true;
            console.log(row.USERLEVEL)
            this.editform = Object.assign({},row)
            // this.saveEdit(row)
            // this.$axios({
            //     url: this.$url + '/UpdateUserRoleApi',
            //     method: 'post',
            //     data:{

            //     }
            // })
        },
        // 保存编辑
        saveEdit() {
            let studenteList=this.editform;
            console.log(studenteList)
            if(typeof(studenteList.ROLE_NAME) == 'string'){
                studenteList.ROLEID = studenteList.ROLEID
            }else{
                studenteList.ROLEID = studenteList.ROLE_NAME
            }
            if(typeof(this.organization) == 'object' || typeof(this.client_no) == 'object'){
                this.$axios({
                url: this.$url + '/UpdateUserApi',
                method: 'post',
                data: {
                    ROLEID: studenteList.ROLEID,
                    TRACK_ID: studenteList.TRACK_ID,
                    NAME: studenteList.NAME,
                    // CLIENT_NO: addform.CLIENT_NO,
                    TELEPHONE: studenteList.TELEPHONE,
                    USERNAME: studenteList.USERNAME,
                    PASSWORD: studenteList.PASSWORD,
                    USERLEVEL: studenteList.USERLEVEL,
                    STREET_ID: studenteList.STREET_ID,
                    COMMUNITY_ID: studenteList.COMMUNITY_ID,
                    VILLAGE_ID: studenteList.VILLAGE_ID,
                    ADDRESS: studenteList.ADDRESS,
                    EMAIL: studenteList.EMAIL,
                    // ROLEID: studenteList.ROLE_NAME,
                    ORGANIZATION: (this.organization).join(''),
                    CLIENT_NO: (this.client_no).join('')
                }
            }).then(res=>{
                console.log(res)
                if(res.data.IsSucess){
                    this.$message.success('编辑成功')
                    this.editVisible = false
                    this.getrolelist()
                }
            })
            }else{
                this.$axios({
                url: this.$url + '/UpdateUserApi',
                method: 'post',
                data: {
                    ROLEID: studenteList.ROLEID,
                    TRACK_ID: studenteList.TRACK_ID,
                    NAME: studenteList.NAME,
                    // CLIENT_NO: addform.CLIENT_NO,
                    TELEPHONE: studenteList.TELEPHONE,
                    USERNAME: studenteList.USERNAME,
                    PASSWORD: studenteList.PASSWORD,
                    USERLEVEL: studenteList.USERLEVEL,
                    STREET_ID: studenteList.STREET_ID,
                    COMMUNITY_ID: studenteList.COMMUNITY_ID,
                    VILLAGE_ID: studenteList.VILLAGE_ID,
                    ADDRESS: studenteList.ADDRESS,
                    EMAIL: studenteList.EMAIL,
                    // ROLEID: studenteList.ROLE_NAME,
                    ORGANIZATION: studenteList.ORGANIZATION,
                    CLIENT_NO: studenteList.CLIENT_NO
                }
            }).then(res=>{
                console.log(res)
                if(res.data.IsSucess){
                    this.$message.success('编辑成功')
                    this.editVisible = false
                    this.getrolelist()
                }
            })
            }
            console.log(studenteList)
        },
        // 分页导航
        handlePageChange(currentPage) {
            this.currentPage = currentPage;
            // this.$set(this.query, 'pageIndex', val);
            // this.getData();
        },
        handleSizeChange(size){
            this.pagesize = size;
        },
        handleDelete(index, row) {
            this.$confirm('确定删除？', '提示', {
                    type: 'warning'
                }).then(res=>{
                this.$axios({
                    url: this.$url + '/DeleteUserApi',
                    method:'get',
                    params:{
                        ID: row.TRACK_ID
                    }
                }).then(res=>{
                    console.log(res)
                    this.$message.success('删除成功')
                    this.getrolelist()
                })
            })
        }
    }
}
</script>
<style scoped>
    /deep/.el-select{
        width: 100%;
    }
    /deep/.handle-input{
        width: 100%;
    }
    .displaynone{
        display: block;
    }
    .displaytnone{
        display: block;
    }
    .displayenone{
        display: block;
    }
    .displayfnone{
        display: block;
    }
</style>